package com.levy.contronller.lamdaTest.compare;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collector;

public class CompareTest1 {

    public static void main(String[] args) {
        List<String> list = Arrays.asList("nihao", "hello", "world", "welcome");
//        Collections.sort(list, Comparator.comparingInt(String::length));
//        Collections.sort(list, (item1, item2) -> item1.length() - item2.length());
//        Collections.sort(list, Comparator.comparingInt(String::length).reversed());

//        Collections.sort(list, Comparator.comparingInt(item -> item.length()).reversed());
//        Collections.sort(list, Comparator.comparingInt((String item) -> item.length()).reversed());
//
//
//        Collections.sort(list,Comparator.comparingInt(String::length).thenComparing(String.CASE_INSENSITIVE_ORDER));
//
//        Collections.sort(list,Comparator.comparingInt(String::length).thenComparing((item1,item2) -> item1.compareTo(item2)));
//
//        Collections.sort(list,Comparator.comparingInt(String::length).thenComparing(Comparator.naturalOrder()));
//
//        Collections.sort(list,Comparator.comparingInt(String::length).thenComparing(Comparator.comparing(String::toLowerCase));

//        Collections.sort(list, Comparator.comparingInt(String::length)
//                .thenComparing(Comparator.comparing(String::toLowerCase, Comparator.reverseOrder())));

        Collections.sort(list, Comparator.comparingInt(String::length)
                .thenComparing(String::toLowerCase, Comparator.reverseOrder()));
        System.out.println(list);

    }


}
